package main

import (
	"fmt"
	"iwencai/src"
	"iwencai/utils/robot"
	"log"
	"os"
)

func main() {
	log.Println("WARN:请访问如下网址，并打开开发者工具，获取Cookie中的v参数，并更新至config.yaml\n" +
		"<<<<<<< http://www.iwencai.com/stockpick/search?" +
		"typed=1&preParams=&ts=1&f=1&qs=result_rewrite&querytype=stock&tid=stockpick&w=000 >>>>>>>")

	if config, err := src.GetConfig(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	} else {
		content := src.IwencaiSpider(src.Args{
			CookieV:      config.CookieV,
			Where:        config.Where,
			Exclude50WUP: config.Exclude50WUP,
		})
		feishu := robot.NewFeishuRichTextRobot()
		feishu.Title = "智能选股"
		feishu.Webhook = config.Webhook
		feishu.Content = content
		feishu.Send()
	}
}
